﻿using BattleFury.Lib.Collections;
using Microsoft.Xna.Framework;

namespace BattleFury.Lib.Screens
{
    public class ScreenCollection : ContentDictionary<string, IScreen>
    {

        public IScreen CurrentScreen { get; private set; }

        public ScreenCollection()
        {
        }

        public override IScreen Add(string key, IScreen item)
        {
            item.Screens = this;
            item.Size = RenderEngine.Get().Resolution;
            return base.Add(key, item);
        }

        public void Change(string screenName)
        {
            CurrentScreen = this[screenName];
        }

        public void Update(GameTime gameTime)
        {
            CurrentScreen.Update(gameTime);
        }

        public void Draw(GameTime gameTime)
        {
            CurrentScreen.Draw(gameTime);
        }
    }
}